<?php

/**
 * Classroom
 * @property	int		$id
 * @property	string	$name
 * @property	string	$capacity
 * @property	string	$created
 * @property	string	$updated
 */
class Classroom extends Node {
    public static function option() {
        return array(
            'table' => 'Classroom',
            'key' => 'id',
            'columns' => array(
                'id' => 'id',
                'name' => 'name',
                'capacity' => 'capacity',
                'created' => 'created',
                'updated' => 'updated',
                'attributeData' => 'attributes',
            ));
    }

    public static function attributesList() {
        return [
            'id',
            'name',
            'capacity',
        ];
    }

    public function remove() {
        $courseClasses = CourseClass::find(new Query('courseId', $this->id), ['nolimit' => 1]);
        foreach ($courseClasses as $courseClass) $courseClass->remove();
        $this->delete();
    }
}